{{include file="Manage/header.html"}}
<body class="login_body">

<div class="login_header">
	<a href="javascript:">培育计划申报</a>
</div>

<div class="login">
	<form method="post" onsubmit="return false">
		<div class="title">用户登录</div>
		<div class="message">
			<input type="text" name="username" placeholder="请输入姓名">
		</div>
		<div class="message">
			<input type="password" name="password" placeholder="请输入密码">
		</div>
		<div class="code">
			<input type="text" name="verify" placeholder="请输入验证码">
			<i><img src="{{$smarty.const.__PUB__}}admin/index.php?app=Public&act=getVerifyCode&cxcyxy" onclick="this.src+='&' + Math.random();" style="cursor:pointer" class="change_verify"></i>
		</div>
		<ul class="dowebok">
			<li><input type="radio" name="grade" data-labelauty="普通用户"  checked value="1"></li>
			<li><input type="radio" name="grade" data-labelauty="管理员" value="0"></li>
		</ul>
		<div class="warm" style="display:none;"></div>
		<button onclick="login();">登录</button>
		<div class="note">
			<span><a href="index.php?app=Login&act=getpassword">忘记密码</a></span>
			<span><a href="index.php?app=Login&act=register">注册</a></span>
		</div>
	</form>
</div>
<script type="text/javascript">
    $(function () {
        $(':input').labelauty();
    })
    //登录验证
    function login(){
        var params = $("form").serialize();
        var role_id = ['0','1','3'];//院系，老师，cxcyxy
        $(".warm").css("display", "block");
        $(".warm").html("正在登录中，请稍等...");
        $.post('{{"index.php?app=Login&act=login"|URL}}',params,function(result){
            if(result.statusCode=='200'){
                if(result.message.type == '2')//学生
                    var url = "{{$smarty.const.__PROJECT__}}Myproject/student";
                else if($.inArray(result.message,role_id))
                    var url = "{{$smarty.const.__PROJECT__}}Myproject/teacher";
                document.location.href = url;//登录后跳转页面
            }else if(result.statusCode=='300'){
                $(".warm").html(result.message);
                $(".change_verify").trigger("click");
                $(".verify").val("");
            }
        },'json');
    };
</script>
{{include file="Manage/footer.html"}}
